import os

print(os.getcwd())

def create_if_not_exists(path):
    """
    如果路径不存在，则创建路径。
    参数:
    path -- 需要检查的路径
    """
    if not os.path.exists(path):
        os.makedirs(path)
        print(f"创建路径：{path}")
    else:
        print(f"路径已存在：{path}")


PATH_DICT = {
    'env':['maven',
           'node',
           'anaconda'],

    'dev':['docker'],
    
    'software':[
        'yuque',
        'TenCentVideo',
        'WYmusic',
        'snipaste',
        'Vscode',
        'sougou',
        'wps',
        'sublime',
        'finalshell',
        '火绒',
        'sourcetree'],

    'code':['git','project'],

    'temp':['']
}

ROOT_PATH = r"D:\test"
if not os.path.exists(ROOT_PATH):
    os.makedirs(ROOT_PATH)
    print(f"创建路径：{ROOT_PATH}")
else:
    print(f"路径已存在：{ROOT_PATH}")

for key,value in PATH_DICT.items():
    tempPath=os.path.join(ROOT_PATH,key)
    create_if_not_exists(tempPath)
    print(key,value)
    for items in value:
        create_if_not_exists(os.path.join(tempPath,items))        
        print(items)
    print('---------------------------')